bitkeeper revision 1.1159.1.400 (4192268botrLPEWBvExDtqcSivVN3g)
authorcl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Wed, 10 Nov 2004 14:32:43 +0000 (14:32 +0000)
committercl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Wed, 10 Nov 2004 14:32:43 +0000 (14:32 +0000)
Move virq to evtchn mapping to exec_domain.

xen/common/event_channel.c
xen/common/keyhandler.c
xen/include/xen/event.h
xen/include/xen/sched.h

index d8e7c9b9eba8b2837065f7a44376884f8c240c12..f3a242ea2ea9d2107f42cb7c9b7ba2fb8b68a12a 100644 (file)
@@ -239,10 +239,11 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
 
 static long evtchn_bind_virq(evtchn_bind_virq_t *bind)
 {
-    struct domain *d = current->domain;
+    struct exec_domain *ed = current;
+    struct domain *d = ed->domain;
     int            port, virq = bind->virq;
 
-    if ( virq >= ARRAY_SIZE(d->virq_to_evtchn) )
+    if ( virq >= ARRAY_SIZE(ed->virq_to_evtchn) )
         return -EINVAL;
 
     spin_lock(&d->event_channel_lock);
@@ -252,7 +253,7 @@ static long evtchn_bind_virq(evtchn_bind_virq_t *bind)
      * bound yet. The exception is the 'misdirect VIRQ', which is permanently 
      * bound to port 0.
      */
-    if ( ((port = d->virq_to_evtchn[virq]) != 0) ||
+    if ( ((port = ed->virq_to_evtchn[virq]) != 0) ||
          (virq == VIRQ_MISDIRECT) ||
          ((port = get_free_port(d)) < 0) )
         goto out;
@@ -260,7 +261,7 @@ static long evtchn_bind_virq(evtchn_bind_virq_t *bind)
     d->event_channel[port].state  = ECS_VIRQ;
     d->event_channel[port].u.virq = virq;
 
-    d->virq_to_evtchn[virq] = port;
+    ed->virq_to_evtchn[virq] = port;
 
  out:
     spin_unlock(&d->event_channel_lock);
@@ -313,6 +314,7 @@ static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
 static long __evtchn_close(struct domain *d1, int port1)
 {
     struct domain   *d2 = NULL;
+    struct exec_domain *ed;
     event_channel_t *chn1, *chn2;
     int              port2;
     long             rc = 0;
@@ -344,7 +346,10 @@ static long __evtchn_close(struct domain *d1, int port1)
         break;
 
     case ECS_VIRQ:
-        d1->virq_to_evtchn[chn1[port1].u.virq] = 0;
+        /* XXX could store exec_domain in chn1[port1].u */
+        for_each_exec_domain(d1, ed)
+            if (ed->virq_to_evtchn[chn1[port1].u.virq] == port1)
+                ed->virq_to_evtchn[chn1[port1].u.virq] = 0;
         break;
 
     case ECS_INTERDOMAIN:
index 90db32cc6cffa79daf2070cc3412c6dc01b046bd..b50e01861b955e4bcf42df83d6604c3f44ff1e36 100644 (file)
@@ -111,10 +111,10 @@ void do_task_queues(unsigned char key)
         ed = d->exec_domain[0];
         printk("Notifying guest... %d/%d\n", d->id, ed->eid); 
         printk("port %d/%d stat %d %d %d\n",
-               VIRQ_DEBUG, d->virq_to_evtchn[VIRQ_DEBUG],
-               test_bit(d->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_pending[0]),
-               test_bit(d->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_mask[0]),
-               test_bit(d->virq_to_evtchn[VIRQ_DEBUG]>>5, &ed->vcpu_info->evtchn_pending_sel));
+               VIRQ_DEBUG, ed->virq_to_evtchn[VIRQ_DEBUG],
+               test_bit(ed->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_pending[0]),
+               test_bit(ed->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_mask[0]),
+               test_bit(ed->virq_to_evtchn[VIRQ_DEBUG]>>5, &ed->vcpu_info->evtchn_pending_sel));
         send_guest_virq(d->exec_domain[0], VIRQ_DEBUG);
     }
 
index c59439608f48442d27c279e8ef7626d549a3eea4..7410c0aa8c730b0c790f33f159211babf4d7ebdd 100644 (file)
@@ -57,7 +57,7 @@ static inline void evtchn_set_pending(struct exec_domain *ed, int port)
  */
 static inline void send_guest_virq(struct exec_domain *ed, int virq)
 {
-    evtchn_set_pending(ed, ed->domain->virq_to_evtchn[virq]);
+    evtchn_set_pending(ed, ed->virq_to_evtchn[virq]);
 }
 
 /*
index e1e06d59f5eef08e52778004340efafe93562abe..8eb1ed015abbee3f7299928ee688863707a1f069 100644 (file)
@@ -98,6 +98,8 @@ struct exec_domain
 
     unsigned long ed_flags;
 
+    u16 virq_to_evtchn[NR_VIRQS];
+
     atomic_t pausecnt;
 
 };
@@ -136,7 +138,6 @@ struct domain {
      */
 #define NR_PIRQS 128 /* Put this somewhere sane! */
     u16 pirq_to_evtchn[NR_PIRQS];
-    u16 virq_to_evtchn[NR_VIRQS];
     u32 pirq_mask[NR_PIRQS/32];
 
     /* Physical I/O */